package com.light.mytext.javaknowledge

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.light.mytext.R
import com.light.mytext.javaknowledge.DPerson.DFood

/**
 * java克隆的使用
 */
class CloneActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_dynamic_proxy)
        init()
//        init1()
    }
    fun init(){
        var bean1=DPerson(1,"文阿花", DPerson().DFood("大米饭"))
        var bean2= bean1.clone() as DPerson
        bean2.food.name="面包"
        bean2.name="wenahua"
        Log.i("Clone==","bean1="+bean1+"bean2="+bean2)
    }
   /* fun init1(){
        var bean1=Person(1,"文阿花")
        var bean2= bean1.clone() as Person
        bean2.id=2
        bean2.uName="wenahua"
        Log.i("Clone1==","bean1="+bean1.uName+"bean2="+bean2.uName)
    }*/
}